<?
include_once 'include/include.php';
c_create::createClass('catalog');
$cata = new catalog();
$outvar[headline] = '分类目录管理';
if ($_POST){
	//if ($_POST['CparentId']>0)$_POST['CparentId']=trim($_POST['CparentId']);
	//else unset($_POST['CparentId']);
	if ($cata->submitTypeRecord($_POST)){
		$_SESSION[showtips]	 = $cata->action.'成功！';
	}else {
		assignMore($cata->error);
		$_SESSION[showtips]	 = $cata->action.'失败！';
	}
}elseif ($_GET[id]){
	$_POST = $cata->getOneType($_GET[id]);
}elseif ($_GET[did]){
	if ($cata->deleteTypeRecord($_GET[did])){
		$_SESSION[showtips]	 = '删除成功！';
	}
}
if ($_POST[Catalogid]){
	$outvar[headline] = '分类目录修改';
}
$outvar[catalog] = $cata->getTypeList();
$i=0;
foreach ($outvar[catalog] as $key=>$value){
	if ($key == $_POST[Catalogid]){
		$record[$i][selected] = true;
	}
	$record[$i][num] = $i+1;
	$record[$i][id] = $key;
	$record[$i][name] = $value;
	$i++;
}
assignMore($_POST);
$outvar[record] = $record;
outFile("catalog");
?>